package com.dev.web.controller.safe;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dev.bbs.bean.BbsSignInfo;
import com.dev.bbs.domain.BbsUser;
import com.dev.bbs.service.IBbsUserSignService;
import com.dev.common.core.controller.BaseController;
import com.dev.common.core.domain.AjaxResult;
import com.dev.framework.util.ShiroUtils;

/**
 * 会员签到Controller
 *
 * @author dev
 * @date 2019-09-21
 */
@Controller
@RequestMapping("safe/sign")
public class SafeUserSigninController extends BaseController
{
    @Autowired
    private IBbsUserSignService bbsUserSignService;

    @PostMapping()
    @ResponseBody
    public AjaxResult sign()
    {
        BbsUser user = ShiroUtils.getBbsUser();
        // 获取数据
        BbsSignInfo sign = bbsUserSignService.sign(user);
        if (null != sign)
        {
            return AjaxResult.success(sign);
        }
        return error("今日已签到");
    }
}
